import Loading from "./Loading.vue";
import Vue from "vue";

//获取loading组件的构造函数，构造loading组件
const LoadingConstructor = Vue.extend(Loading);

const serve = () => {
  // 创建实例
  let loadingInstance = new LoadingConstructor();
  // 将组件挂载带到元素
  loadingInstance.$mount(document.createElement("div"));
  // 将挂载的元素添加到body中
  document.body.appendChild(loadingInstance.$el);
  Vue.nextTick(() => {
    loadingInstance.visible = true;
  });
  return loadingInstance;
};

export default serve;
